package com.tpo.jnotes.client.layer.view.dialogs;

import java.util.HashMap;

import com.tpo.jnotes.client.layer.binding.BindingsEnum;
import com.tpo.jnotes.client.main.Logging;

public class NFrame extends NBaseFrame
{
    private int id;
    private String text;
    private String title;

    private HashMap< String, String > bindings;

    public NFrame( int id )
    {
        super();
        this.id = id;
    }

    @Override
    public int getId()
    {
        return id;
    }

    public void setId( int id )
    {
        this.id = id;
    }

    public void setText( String text )
    {
        Logging.trace( "NoteFrame > TEXT = " + text );
        this.text = text;
        noteEditor.setText( text );
    }

    @Override
    public String getText()
    {
        return text;
    }

    @Override
    public void setTitle( String title )
    {
        this.title = title;
        Logging.trace( "NoteFrame > TITLE = " + title );
        titleEditor.setText( title );
        setText( title );
    }

    @Override
    public String getTitle()
    {
        return title;
    }

    @Override
    public HashMap< String, String > getBindings()
    {
        if( bindings == null )
        {
            bindings = new HashMap< String, String >();
            bindings.put( BindingsEnum.text.name(), BindingsEnum.text.name() );
            bindings.put( BindingsEnum.title.name(), BindingsEnum.title.name() );
        }
        return bindings;
    }

}
